package is.ru.honn.rupin.data;

import is.ru.honn.rupin.domain.Gender;
import is.ru.honn.rupin.domain.User;
import org.springframework.jdbc.core.simple.ParameterizedRowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by Sigrún Inga Kristinsdóttir.
 * Date: 19.10.2012
 * Time: 15:51
 * copyright (c) sigruninga&susanne
 *
 * @author Sigrún Inga kristindóttir og Susanne Götz
 * @version 1.1
 */

/**
 * Mapper sem er notaður í UserData.
 */
public class UserRowMapper implements ParameterizedRowMapper<User> {

    public User mapRow(ResultSet resultSet, int i) throws SQLException
    {
            User user = new User(resultSet.getString("username"),
            resultSet.getString("firstName"),
            resultSet.getString("lastName"),
            resultSet.getString("email"),
            resultSet.getString("passw"),
            Gender.valueOf(resultSet.getString("gender")));
            return user;

    }
}

